local UserInfoLayer = class("UserInfoLayer", require "widget/BaseUI")
 
function UserInfoLayer.show()
    print("============UserInfoLayer.show===============")
 
    local win = UserInfoLayer.new()

    local data = getWndInitParamList()
    data.isRemoveResource = false
    data.imgTitle = nil
    data.bgImage = nil
    data.isShowCover = false,

    win:init(data)
    win:showWindow()

    return win

end

function UserInfoLayer:ctor() 
    UserInfoLayer.super:ctor();
end


function UserInfoLayer:init(data)
    self:initWithParas(data)
    
    self.m_Json = ccs.GUIReader:getInstance():widgetFromJsonFile("image/ui/Json/LayerUserInfo.json")
    self:setContentSize(self.m_Json:getContentSize())
    self.m_Json:setPositionX(-self.m_Json:getContentSize().width/2)
    self.m_Json:setPositionY(-self.m_Json:getContentSize().height/2)
    self:addChild(self.m_Json)
    
    self.m_TextFieldCardID = self.m_Json:getChildByName("Info_PassID")
    self.m_TextFieldMobile = self.m_Json:getChildByName("Info_MobileID")
    self.m_TextFieldName = self.m_Json:getChildByName("Info_Name")
    self.m_TextFieldSpecial = self.m_Json:getChildByName("tf_Special")
    self.m_TextFieldName2 = self.m_Json:getChildByName("tf_Name")
    
    self.m_LabelUseLevel = self.m_Json:getChildByName("use_Level")
    self.m_LabelUseWIn100 = self.m_Json:getChildByName("use_WIn100")
    self.m_LabelUseHFCount = self.m_Json:getChildByName("use_HFCount")
    self.m_LabelUseSpecial = self.m_Json:getChildByName("use_Special")
    self.m_LabelUsePlayCount = self.m_Json:getChildByName("use_PlayCount")
    self.m_LabelUseNickName = self.m_Json:getChildByName("use_NickName")
    self.m_LabelUseAccount = self.m_Json:getChildByName("use_Account")
    self.m_LabelUseGold = self.m_Json:getChildByName("use_Gold")
  
   
    self.m_BtnHeadFace = ccui.Helper:seekWidgetByName(self.m_Json,"bt_head")
    self.m_BtnHeadFace:setTouchEnabled(true)
    self.m_BtnHeadFace:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnInfo1 = self.m_Json:getChildByName("u_bt_Normal")
    self.m_BtnInfo1:setTouchEnabled(true)
    self.m_BtnInfo1:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnInfo2 = self.m_Json:getChildByName("u_bt_Info")
    self.m_BtnInfo2:setTouchEnabled(true)
    self.m_BtnInfo2:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnInfo3 = self.m_Json:getChildByName("u_bt_bisai")
    self.m_BtnInfo3:setTouchEnabled(true)
    self.m_BtnInfo3:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    
    self.m_BtnMale = ccui.Helper:seekWidgetByName(self.m_Json,"sex_font1")
    self.m_BtnMale:setTouchEnabled(true)
    self.m_BtnMale:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_Btnfamale = ccui.Helper:seekWidgetByName(self.m_Json,"sex_font0")
    self.m_Btnfamale:setTouchEnabled(true)
    self.m_Btnfamale:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnUnknown  = ccui.Helper:seekWidgetByName(self.m_Json,"sex_dot1")
    self.m_BtnUnknown:setTouchEnabled(true)
    self.m_BtnUnknown:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnSend = ccui.Helper:seekWidgetByName(self.m_Json,"d_bt_Send")
    self.m_BtnSend:setTouchEnabled(true)
    self.m_BtnSend:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnSure = ccui.Helper:seekWidgetByName(self.m_Json,"d_bt_Sure")
    self.m_BtnSure:setTouchEnabled(true)
    self.m_BtnSure:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnUpdate = ccui.Helper:seekWidgetByName(self.m_Json,"d_bt_Change")
    self.m_BtnUpdate:setTouchEnabled(true)
    self.m_BtnUpdate:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnBack = self.m_Json:getChildByName("lu_bt_back")
    self.m_BtnBack:setTouchEnabled(true)
    self.m_BtnBack:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_ImageViewSelect = self.m_Json:getChildByName("im_selectdot")
    self.m_ImageViewFaceBg = self.m_Json:getChildByName("scale9_im_nickname")
    self.m_ImageViewIDBg = self.m_Json:getChildByName("scale9_im_userid")
    self.m_ImageViewMobileBg = self.m_Json:getChildByName("scale9_im_mobile")
    self.m_ImageViewUseHead = self.m_Json:getChildByName("use_Head")
    self.m_ImageViewGender = self.m_Json:getChildByName("img_sex")
   
    self.m_PanelMatch = self.m_Json:getChildByName("uc_Layer_bisai")
    self.m_PanelUserInfo = self.m_Json:getChildByName("uc_Layer_info")
    self.m_PanelNormal = self.m_Json:getChildByName("uc_Layer_normal")
    self.m_PanelLayerChange = self.m_Json:getChildByName("LayerChange")   
    
  
end


function UserInfoLayer:onMenutClick(sender,eventType)
    if eventType == ccui.TouchEventType.ended then
        if sender == self.m_BtnHeadFace then     
            print "=========UserInfoLayer:onMenutClick m_BtnHeadFace======================="
        elseif sender == self.m_BtnInfo1 then     
            print "=========UserInfoLayer:onMenutClick m_BtnInfo1======================="
        elseif sender == self.m_BtnInfo2 then     
            print "=========UserInfoLayer:onMenutClick m_BtnInfo2======================="
        elseif sender == self.m_BtnInfo3 then     
            print "=========UserInfoLayer:onMenutClick m_BtnInfo3======================="
        elseif sender == self.m_BtnMale then     
            print "=========UserInfoLayer:onMenutClick m_BtnMale======================="
        elseif sender == self.m_Btnfamale then     
            print "=========UserInfoLayer:onMenutClick m_Btnfamale======================="
        elseif sender == self.m_BtnUnknown then     
            print "=========UserInfoLayer:onMenutClick m_BtnUnknown======================="
        elseif sender == self.m_BtnSend then     
            print "=========UserInfoLayer:onMenutClick m_BtnSend======================="
        elseif sender == self.m_BtnSure then     
            print "=========UserInfoLayer:onMenutClick m_BtnSure======================="
        elseif sender == self.m_BtnUpdate then     
            print "=========UserInfoLayer:onMenutClick m_BtnUpdate======================="
        elseif sender == self.m_BtnBack then     
            print "=========UserInfoLayer:onMenutClick m_BtnBack======================="
            self:closeWindow()
        end
    end
end
 
return UserInfoLayer